Replace deprecated model.NameValidationScheme with explicit UTF8Validation#2051
Merged
Merged
Conversation
…ameValidationScheme model.NameValidationScheme is deprecated in prometheus/common. Replace its three uses (desc.go, labels.go, push/push.go) with the explicit model.UTF8Validation scheme and drop the now-unneeded //nolint:staticcheck directives. The global already defaults to UTF8Validation, so default validation behavior is unchanged; setups that set it to LegacyValidation no longer have that enforced at construction, and UTF-8 validation is more permissive, so no currently-valid name starts failing. Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
Signed-off-by: Kemal Akkoyun <kemal.akkoyun@datadoghq.com>
bwplotka
reviewed
Jul 8, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
model.NameValidationSchemeis deprecated in prometheus/common. staticcheck flags each use, and under some golangci-lint cache states the suppressing//nolintdirectives are themselves reported as unused, which makes lint flaky.This replaces the three uses (
desc.go,labels.go,push/push.go) with the explicitmodel.UTF8Validationscheme and removes the//nolintdirectives.NameValidationSchemealready defaults toUTF8Validation, so default behavior is unchanged. Users who set it toLegacyValidationno longer get that enforcement at metric/label/grouping construction; UTF-8 validation is more permissive, so no name that validates today starts failing.Test plan:
go test -race ./prometheus/... ./prometheus/push/...passes andgolangci-lint runis clean.